<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/12/6/006
 * Time: 8:57
 */

namespace app\api\model;


class Attribute extends BaseModel {

    public function getImageAttr($value) {
        return get_img_url($value);
    }

    /**
     * 获取属性值
     * @return \think\model\relation\HasMany
     */
    public function attrValue() {
        return $this->hasMany('AttrValue');
    }

    /**
     * 根据ID获取属性列表
     * @param $ids
     * @return array|\PDOStatement|string|\think\Collection
     */
    public static function getAttrByIds($ids) {
        $attr = self::where('id', 'in', $ids)->select();
        return $attr;
    }
}